//package com.cuit.mimall.config.fileUploadConfig;
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.io.FileSystemResource;
//import org.springframework.util.unit.DataSize;
//import org.springframework.web.multipart.MultipartResolver;
//import org.springframework.web.multipart.commons.CommonsMultipartResolver;
//
//import java.io.IOException;
//
//@Configuration
//public class FileUploadConfig {
//    @Value("${spring.servlet.multipart.max-file-size}")
//    private String maxFileSize;
//
//    @Value("${spring.servlet.multipart.max-request-size}")
//    private String maxRequestSize;
//
//    @Value("${file.upload.tmp}")
//    private String tmpFolderPath;
//
//    @Bean
//    public MultipartResolver multipartResolver() throws IOException {
//        CommonsMultipartResolver resolver = new CommonsMultipartResolver();
//        resolver.setMaxUploadSize(Long.parseLong(String.valueOf(DataSize.parse(maxFileSize).toBytes())));
//        resolver.setMaxUploadSizePerFile(Long.parseLong(String.valueOf(DataSize.parse(maxRequestSize).toBytes())));
//        resolver.setResolveLazily(true);
//        resolver.setUploadTempDir(new FileSystemResource(tmpFolderPath));
//        return resolver;
//    }
//}
